//
//  Test7.cpp
//  CPPTest
//
//  Created by you5 Yi on 2021/9/6.
//

#include "Test7.hpp"
#include <iostream>
#include <string>
using namespace std;
class str {
private:
    char *st;
public:
    str(char *a) {
        set(a);
    }
    str & operator = (str &a) {
        delete st;
        set(a.st);
        return *this;
    }
    void show() {
        std::cout<< st << std::endl;
    }
    ~str() {
        delete st;
    }
    void set(char *s) {
        st = new char[strlen(s)+1];
        strcpy(st, s);
    }
};

void test7() {
    str s1("he"),s2("she");
    s1.show(),s2.show();
    s2 = s1;
    s1.show(),s2.show();
}
